package com.lemon.tieba.user.service.impl;

import com.lemon.common.service.impl.BaseServiceImpl;
import com.lemon.tieba.user.domain.User;
import com.lemon.tieba.user.mapper.UserMapper;
import com.lemon.tieba.user.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户 ServiceImpl
 *
 * @author ymh
 * @date 2019-3-22 16:31
 */
@Service
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {

    @Autowired
    private UserMapper userMapper;

    /**
     * 登录
     *
     * @param username
     * @param password
     * @return
     */
    @Override
    public User login(String username, String password) {
        User user = new User();
        user.setUsername(username);
        user.setPassword(password);
        return userMapper.selectOne(user);
    }

    /**
     * 根据用户名查询用户
     *
     * @param username
     * @return
     */
    @Override
    public User selectByUsername(String username) {
        User user = new User();
        user.setUsername(username);
        return userMapper.selectOne(user);
    }
}
